package class_and_object.homework;

/**
 * @author haomin
 * @date 2022/05/30 22:53
 **/
import java.util.Scanner;
public class Test_12_3 {
    public static void main(String[] args) {
        int[] a = new int[100];
        int count = 0;
        for(int i = 0; i < 100; i++){
            a[i] = ((int) (Math.random() * 100) + 1);
        }

        try {
            Scanner sc = new Scanner(System.in);
            System.out.println("\n输入数组下标: ");
            String str = sc.nextLine();
            while (!str.equals(".")) {
                System.out.println("对应的元素值: " + a[Integer.valueOf(str)]);
                System.out.println("输入数组下标: ");
                str = sc.nextLine();
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("Out Of Bounds");
        }
    }
}